var EnemyEmit = require('./EnemyEmit');
cc.Class(
{
    extends: EnemyEmit,

    properties:
    {
        nodeRoll:
        {
            default: null,
            type: cc.Node,
            displayName: '旋转节点'
        },

        offsetRotat:
        {
            default: 0,
            displayName: '偏移角度'
        },

        sendTime:
        {
            default: 2,
            displayName: '发射时间'
        }
    },
    /**
     * 枪口发射动作
     */
    sendAction: function(nodeBullet)
    {
        this._super();
        var x0 = 0;
        var y0 = 0;
        var r = cc.winSize.width > cc.winSize.height ? cc.winSize.width : cc.winSize.height;
        var a = 100;
        if (!!this.nodeRoll)
        {
            a = 2 * Math.PI * (this.nodeRoll.rotation + this.offsetRotat) / -360;
        }
        var x = x0 + r * Math.cos(a);
        var y = y0 + r * Math.sin(a);
        if (null != nodeBullet)
        {
            nodeBullet.runAction(cc.moveTo(this.sendTime, cc.v2(x, y)));
        }
    }
});